Skip to content

backend/docker-compose: remove race condition and improve interactive dev experience - #627

Merged
t-lo merged 2 commits into
mainfrom
t-lo/improve-backend-docker-compose
Dec 1, 2022
Merged

backend/docker-compose: remove race condition and improve interactive dev experience#627
t-lo merged 2 commits into
mainfrom
t-lo/improve-backend-docker-compose

Conversation

@t-lo

@t-lo t-lo commented Nov 24, 2022

Copy link
Copy Markdown
Member

This change adds a dependency to the (nebraska) "server" service on the "postgres" service in docker-compose.test.yaml. Motivation of the change is to prevent a race condition where the "server" container starts faster than "postgres", fails to connect to the database, and shuts down.

Additionally, an optional persistent storage for postgres is added. DB contents can be persisted across docker-compose runs to aid manual, interactive testing. Usage instructions have been added to the YAML files as comments. The local directory used for persiting postgres data has been added to .gitignore to prevent accidental commits.

Tested locally with:

  • docker-compose --file docker-compose.test.yaml build (works as expected)
  • docker-compose --file docker-compose.test.yaml up (works as expected)
  • docker-compose --file docker-compose.test.yaml --file docker-compose.pg-persist.yaml up
    • create a new package, assign to a channel
    • docker-compose --file docker-compose.test.yaml --file docker-compose.pg-persist.yaml down
    • docker-compose --file docker-compose.test.yaml --file docker-compose.pg-persist.yaml up
    • Package still present in web interface

@t-lo
t-lo requested review from illume and wrl November 24, 2022 16:00
@t-lo
t-lo force-pushed the t-lo/improve-backend-docker-compose branch from 45f496d to 2bc1261 Compare November 24, 2022 16:02
@joaquimrocha
joaquimrocha requested a review from yolossn November 24, 2022 18:01

@illume illume left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool. Thanks.

I wonder if it makes sense to add a make target for the persistence. For documentation/ease of use.

Comment thread backend/docker-compose.test.yaml
@t-lo
t-lo force-pushed the t-lo/improve-backend-docker-compose branch 2 times, most recently from 78ca8a4 to 784cb39 Compare November 25, 2022 07:35
This change adds a dependency to the (nebraska) "server" service on the
"postgres" service in docker-compose.test.yaml.
Motivation of the change is to prevent a race condition where the
"server" container starts faster than "postgres", fails to connect to
the database, and shuts down.

Additionally, an optional persistent storage for postgres is added.
DB contents can be persisted across docker-compose runs to aid manual,
interactive testing. Usage instructions have been added to the YAML
files as comments. The local directory used for persiting postgres data
has been added to .gitignore to prevent accidental commits.

Signed-off-by: Thilo Fromm <thilofromm@microsoft.com>
@t-lo
t-lo force-pushed the t-lo/improve-backend-docker-compose branch from 784cb39 to f1f0704 Compare November 25, 2022 07:36
@t-lo
t-lo requested a review from illume November 25, 2022 08:05
Comment thread backend/docker-compose.test.yaml Outdated
…ice restart

Co-authored-by: Kai Lüke <pothos@users.noreply.github.com>
@t-lo
t-lo merged commit 83330dc into main Dec 1, 2022
@t-lo
t-lo deleted the t-lo/improve-backend-docker-compose branch December 1, 2022 08:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants